﻿using Autofac;
using Microsoft.AspNetCore.Http;
using Solution.Comm.DomainInterfaces;
using Solution.EntityFrameworkCore;
using Solution.Repository.Base;
using Solution.Repository.Interfaces.Base;
using Solution.Services.Employee;
using Solution.Services.User;

namespace Web.Injection
{
    public class Evolution : Module
    {
        protected override void Load(ContainerBuilder builder)
        {
            //builder.RegisterType<IUnitOfWork>().As<UnitOfWork<SolutionDbContext>>() ; ;
            builder.RegisterType<UnitOfWork<SolutionDbContext>>().As<IUnitOfWork>(); ;
            //
            builder.RegisterType<SysUserRepository>().As<ISysUserRepository>(); ;//SysUserRepository
            builder.RegisterType<UserServices>().As<IUserServices>(); ;//UserService注入到IUserService

            builder.RegisterType<EmployeeReppository>().As<IEmployeeRepository>(); ;//SysUserRepository
            builder.RegisterType<EmployeeServices>().As<IEmployeeServices>(); ;//UserService注入到IUserService


            builder.RegisterType<HttpContextAccessor>().As<IHttpContextAccessor>(); ;

        }
    }
}